package com.ctg.behavior.calc.impala.builder.ltv;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.ctg.behavior.calc.impala.report.ltv.CtLTVMeasureReport;
import com.ctg.behavior.calc.impala.report.ltv.CtLTVReport;
import com.ctg.behavior.common.ltv.CtLTVCalcBody;

import lombok.extern.slf4j.Slf4j;

@Slf4j
@Component
public class CtLTVReportBuilder {

	@Autowired
	private CtLTVMeasureReportBuilder measureReportBuilder;

	/****************************************************************
	 * @apiNote:
	 */
	public CtLTVReport doBuilder(CtLTVCalcBody calcBody) {

		log.info("calcBody.measures={}", calcBody.getMeasures().size());

		CtLTVReport ltvReport = new CtLTVReport();
		List<CtLTVMeasureReport> measureReports = measureReportBuilder.doBuilder(calcBody);
		ltvReport.setMeasureReports(measureReports);
		if(calcBody.getMeasures().size()>1) {
			// 多个事件
			ltvReport.setIsMultiMeasure(true);
		}

		log.info("calcReports.size={}", measureReports.size());

		return ltvReport;

	}

}
